/*
 * ChildSample.java
 *
 * Copyright 2011 Anish
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 *     
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.aosp.nanoxstream.utils;

import java.util.Vector;

import com.aosp.nanoxstream.Field;
import com.aosp.nanoxstream.XMLStreamProvider;

/**
 * 
 * <code>ChildSample.java</code>
 * <p> </p>
 * @author Anish , anishkumar.ka@gmail.com
 * <dt><b>Date: </b><dd>Jan 6, 2011
 * <dt><b>Module: </b><dd>nanoxstream-testclient
 * <dt><b>Package: </b><dd>com.aosp.nanoxstream.utils
 * <dt>TODO:<dd>
 */
public class ChildSample implements XMLStreamProvider{

	private String childName1 = null;

	private String childName2 = null;

	private Childs childs = null;

	public ChildSample() {
	}

	public String getChildName1() {
		return childName1;
	}

	/*
	 * (non-Javadoc)
	 * @see com.aosp.xmlparser.XMLStreamProvider#getFieldValue(java.lang.String)
	 */
	public Object getFieldValue(String fieldName) {
		if(fieldName.equalsIgnoreCase("childName1")){
			return childName1;
		}
		if(fieldName.equalsIgnoreCase("childName2")){
			return childName2;
		}
		if(fieldName.equalsIgnoreCase("childs")){
			return childs;
		}
		return null;
	}

	/*
	 * (non-Javadoc)
	 * @see com.aosp.xmlparser.XMLStreamProvider#setFieldValue(java.lang.String, java.lang.Object)
	 */
	public void setFieldValue(String fieldName, Object newValue) {
		if(fieldName.equalsIgnoreCase("childName1")){
			childName1=(String) newValue;
		}
		if(fieldName.equalsIgnoreCase("childName2")){
			childName2=(String) newValue;
		}
		if(fieldName.equalsIgnoreCase("childs")){
			childs=(Childs) newValue;
		}
	}

	public String getChildName2() {
		return childName2;
	}

	/*
	 * (non-Javadoc)
	 * @see com.aosp.xmlparser.XMLStreamProvider#getDeclaredFields()
	 */
	public Vector getDeclaredFields() {
		Vector declaredFields = new Vector();
		declaredFields.addElement(new Field("childName1"));
		declaredFields.addElement(new Field("childName2"));
		declaredFields.addElement(new Field("childs"));
		return declaredFields;
	}

	public Childs getChilds() {
		return childs;
	}

}
